export default {
  computed: {
    fieldLib: {
      caches: false,
      get() {
        return this.designer.fieldLib
      }
    }
  },
  methods: {
    toTableColEdit(id) {
      this.designer.setSelected(id)
    },
    addCol() {
      const id = this.designer.createNewUid('table_col')
      // console.log('addCol', id)
      this.designer.addFieldLib({
        id,
        group: 'field',
        type: null,
        options: {
          name: id,
          tableLabel: id,
          tableColField: null
        }
      })
      this.optionModel.tableCols.push(id)
    },
    deleteCol(id, idx) {
      this.optionModel.tableCols.splice(idx, 1)
      this.designer.removeFieldLib(id)
      this.designer.emitEvent('tableColChange')
    }
  }
}
